﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Corsat.Library.Logic;

namespace Corsat.Web
{
    public partial class Results : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLoad_Click(object sender, EventArgs e)
        {
            if(txtCorsatId.Text == "") return;
            lblAccountName.Text = "";

            int CorsatId = Convert.ToInt32(txtCorsatId.Text);

            AccountResults result = Corsat.Library.DataManager.Main.GetAccountResults(CorsatId);

            gvTechResults.DataSource = result.TechResult;
            gvTechResults.DataBind();

            lblAccountName.Text = result.Name;

            if ( result.TechResult.Rows.Count ==0)
                pnlResults.Visible = false;
            else
                pnlResults.Visible = true;

            gvResults.DataSource = result.CoursesResults;
            gvResults.DataBind();
        }
    }
}